﻿@{
    ViewBag.Title = "Index";
}
<h2>
    Dashboard</h2>


    Start by
      @Html.ActionLink(PMKB_DAL.PMKBEntities_resource.Link_AddNew,MVC.Link.AddNewItem())
    <br />
    
    Then you can 
    <br />
    <a href='javascript:AddFavorites()'>Add Favorites</a>
    <ul id="ulFav" style="display:none"></ul>

    <br />or<br />
    <a href='javascript:SearchLink()'>Search links</a>
    
    <br />

Then you can read help.     



Favorite tags<br />

<script type="text/javascript">
    function SearchLink(){
        Search('@Html.Raw(Url.Action(MVC.Link.Index(1, 10, "aaa")))', 'aaa');
    }
    function AddFavorites() {
        window.location = '@Url.Action(MVC.plugin.All.GotoPlugin("displayfav"))';
    }
    function LoadFavorites() {

        TheUrl = '@Url.Action(MVC.plugin.All.Index())' + '/displayfav/GetData';
        
        $.ajax({
            type: "POST",
            url: TheUrl,
            // data: { id: TheId, name: Thename },
            datatype: "JSON",
            success: function (returndata) {
                if (returndata.ok) {
                    var ulfav = $("#ulFav");
                    
                    $.each(returndata.data , function (index, itemData) {

                        ulfav.append('<li><a href=" ' + itemData.AdditionalData + '">' +  itemData.Value + '</a></li>');
                    }
                    );
                    ulfav.show('explode');
                }
                else {
                    //this is an error from the communication network
                    //do not display on dashboard
                   // window.alert(' error : ' + returndata.message);
                }

            }
        }
        );
    }
    
    window.setTimeout(LoadFavorites,100);
    

    </script>



